let log4js = require('log4js');
 log4js.configure({
    appenders: {fileout: { type: "file", filename: "./logs/market.log" },consoleout: { type: "console" }},
    categories: {default: { appenders: ["fileout","consoleout"], level: "info" }}
})
let log = log4js.getLogger("market");
log.level = "info"; // default level is OFF - which means no logs at all.

const QUICKNODE_RPC_URL =
    'https://sly-snowy-resonance.bsc.quiknode.pro/df130e3b4a962f23bc90ff2233d5fcb03315655e' // BSC 主网 RPC 节点

const ethers = require("ethers");
const dayjs = require("dayjs");
const Big = require('big.js');

const db = require("./common/mysql");
const redis = require("./common/redis");
const config = require("./common/config").config;


// BSC
// 私钥和钱包地址
const providerUrl = config.rpcProviderUrl;  // 替换为你的 QuickNode URL
const provider = new ethers.JsonRpcProvider(providerUrl);

const privateKey = config.walletPrivateKey;  // 替换为你的私钥
const wallet = new ethers.Wallet(privateKey, provider);

const contractAddress = config.contractAddress;
const contractABI = require("./common/abi.json");
const contract = new ethers.Contract(contractAddress, contractABI, wallet);



function main(){
    const provider = new ethers.JsonRpcProvider(QUICKNODE_RPC_URL);

    const contractAddress = "0xadfcef048008ea4320fc7072ca06bb4744d5ee0e";

    //const storageSlot = "0x0000000000000000000000000000000000000000000000000000000000000000"; // slot 0

    const storageSlot = "0x511463cc258701e79a5abd741322918889707fafb6385a481e313803ba60b6bb";

    provider.getStorageAt(contractAddress, storageSlot).then((data) => {

    const address = "0x" + data.slice(-40);

    console.log("Max Address:", address);

    });
}

main();






